﻿using Asion.Dapper.SqlBuilder.Condition;
using System;
using System.Collections.Generic;
using System.Text;

namespace Asion.Dapper.SqlBuilder
{
    public interface ISimpleCurdSqlBuilder<TEntity> where TEntity : IEntity
    {

        /// <summary>
        /// insert sql
        /// </summary>
        /// <param name="isReturnId"> true add select id sql</param>
        /// <returns></returns>
        string GetInsertSql<Entity>(Entity type, bool isCheckNull, List<string> excludes = null, bool isReturnId = false);

        string GetDeleteSql(IWhere where);


        string GetUpdateSql<Entity>(Entity type, IUpdateWhere where, List<string> excludes = null);

        /// <summary>
        /// 获取批量更新sql 
        /// </summary>
        /// <typeparam name="Entity"></typeparam>
        /// <param name="type"></param>
        /// <param name="updateColumns"></param>
        /// <returns></returns>
        string GetBatchUpdateSql<Entity>(IBatchUpdate updateColumns, IWhere where);
        string GetUpdateSql<Entity>(IUpdateColumn column, IWhere where);

        string GetUpdateCountSql<Entity>(string column, UpdateCountType countType, int value, IWhere where);

        /// <summary>
        /// get select sql
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        string GetSelectSql(ISelectColumn column, IWhere where, IOrderBy order = null, IGroupColumn groupBy = null, int topCount = 0);

        /// <summary>
        /// get select sql
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        string GetSelectPagedSql(ISelectColumn column, IWhere where, int pageNumber = 1, int rowsPerPage = DapperConfiguration.default_rows_page, IOrderBy order = null);

        string GetSelectExistSql(IWhere where);


        string GetSelectExistSql(IUpdateWhere where);

        string GetSelectCountSql(IWhere where);

    }
}
